package com.slz3.business.module.goodsManagement.gooInventory.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.goodsManagement.gooInventory.domain.GooInventory;
import com.slz3.business.module.goodsManagement.gooInventory.domain.GooInventoryFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class GooInventoryTransactionalServiceImpl implements GooInventoryTransactionalService {

    @Override
    public GooInventory modify(GooInventory gooInventoryNew) {
        Repositorys.gooInventory.test();
        Repositorys.gooInventory.save(GooInventoryFactory.initBaseFields());
        System.err.println(1/0);
        gooInventoryNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.gooInventory.saveAndFlush(gooInventoryNew);
    }

    @Override
    public List<GooInventory> batchModify(List<GooInventory> gooInventoryList) {
        return Repositorys.gooInventory.saveAll(gooInventoryList);
    }
}
